<?php $this->_extends('_layouts/main_layout'); ?>
<?php $this->_block('title'); ?>
<?php echo "Creatives"; ?>
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>
<div id="content" class="box">
	<h1>Creatives</h1>
	<div id="menu" class="box">
		<ul class="box">
			<li><a href="<?php echo url('creative/add', array('site_id'=>$site['id']));?>"><span>Add</span></a></li>
		</ul>
	</div>
	
		<?php if (isset($infos)) 
				{
					foreach ($infos as $info)
					{
		?>
				<p class="msg info"><?php echo $info;?></p>
		<?php		}
				}
		?>
	<table class="full-size">
		<tbody>
			<tr>
				<th>ID</th>
				<th>Name</th>
				<th>Type</th>
				<th>Size</th>
				<th>Actions</th>
			</tr>
			<?php
				if(!empty($creatives)):
					$bg = false;
					foreach ($creatives as $cre)
					{
			?>
				<tr <?php if ($bg) echo 'class="bg"';?>>
					<td><?php echo $cre['id'];?></td>
					<td><?php echo $cre['name'];?></td>
					<td><?php echo Util::getCreativeType($cre['type']);?></td>
					<td><?php if($cre['type'] != 3) echo Util::getCreativeSize($cre['size']);?></td>
					<td>
					<a href="<?php echo url('creative/edit', array('id'=>$cre['id']));?>">Edit</a>
					</td>
				</tr>
			<?php
						$bg = !$bg;
					}
				endif;
			?>
		</tbody>
	</table>
</div>
<?php $this->_endblock(); ?>
